package spe.ui.action;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;

public class OpenViewAction extends Action 
{
	private IWorkbenchPage page;
	private String viewId;
	private String text;
	
	public OpenViewAction()
	{
		super();
	}
	
	public OpenViewAction(IWorkbenchPage page, String viewId, String text)
	{
		super();
		this.page = page;
		this.viewId = viewId;
		this.text = text;
	}
	
	@Override
	public String getText()
	{
		return text;
	}
	
	@Override
	public void run()
	{
		try {
			page.showView(viewId);
		} catch (PartInitException e) {
			e.printStackTrace();
		}
	}
}
